load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "multiregionccl",
    srcs = ["multiregion.go"],
    importpath = "github.com/cockroachdb/cockroach/pkg/ccl/multiregionccl",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/ccl/utilccl",
        "//pkg/settings/cluster",
        "//pkg/sql",
        "//pkg/sql/catalog/catpb",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/catalog/multiregion",
        "//pkg/sql/catalog/typedesc",
        "//pkg/sql/pgwire/pgcode",
        "//pkg/sql/pgwire/pgerror",
        "//pkg/sql/sem/eval",
        "//pkg/sql/sem/tree",
    ],
)

go_test(
    name = "multiregionccl_test",
    size = "enormous",
    srcs = [
        "cold_start_latency_test.go",
        "datadriven_test.go",
        "main_test.go",
        "multiregion_system_table_test.go",
        "multiregion_test.go",
        "region_test.go",
        "region_util_test.go",
        "regional_by_row_system_database_test.go",
        "regional_by_row_test.go",
        "regionliveness_test.go",
        "roundtrips_test.go",
        "show_test.go",
        "unique_test.go",
    ],
    data = glob(["testdata/**"]),
    embed = [":multiregionccl"],
    exec_properties = select({
        "//build/toolchains:is_heavy": {"test.Pool": "heavy"},
        "//conditions:default": {"test.Pool": "large"},
    }),
    shard_count = 16,
    deps = [
        "//pkg/base",
        "//pkg/ccl",
        "//pkg/ccl/multiregionccl/multiregionccltestutils",
        "//pkg/ccl/partitionccl",
        "//pkg/ccl/testutilsccl",
        "//pkg/clusterversion",
        "//pkg/jobs",
        "//pkg/jobs/jobspb",
        "//pkg/keys",
        "//pkg/kv",
        "//pkg/kv/kvbase",
        "//pkg/kv/kvclient/kvcoord",
        "//pkg/kv/kvpb",
        "//pkg/kv/kvserver",
        "//pkg/kv/kvserver/allocator/allocatorimpl",
        "//pkg/roachpb",
        "//pkg/rpc",
        "//pkg/security/securityassets",
        "//pkg/security/securitytest",
        "//pkg/server",
        "//pkg/server/serverpb",
        "//pkg/settings/cluster",
        "//pkg/spanconfig",
        "//pkg/sql",
        "//pkg/sql/catalog",
        "//pkg/sql/catalog/catpb",
        "//pkg/sql/catalog/descpb",
        "//pkg/sql/catalog/descs",
        "//pkg/sql/catalog/desctestutils",
        "//pkg/sql/catalog/lease",
        "//pkg/sql/catalog/systemschema",
        "//pkg/sql/catalog/typedesc",
        "//pkg/sql/enum",
        "//pkg/sql/execinfra",
        "//pkg/sql/isql",
        "//pkg/sql/parser",
        "//pkg/sql/regionliveness",
        "//pkg/sql/regions",
        "//pkg/sql/rowenc",
        "//pkg/sql/sem/tree",
        "//pkg/sql/sqlinstance/instancestorage",
        "//pkg/sql/sqlliveness",
        "//pkg/sql/sqlliveness/slbase",
        "//pkg/sql/sqlliveness/slstorage",
        "//pkg/sql/sqltestutils",
        "//pkg/testutils",
        "//pkg/testutils/datapathutils",
        "//pkg/testutils/serverutils",
        "//pkg/testutils/serverutils/regionlatency",
        "//pkg/testutils/skip",
        "//pkg/testutils/sqlutils",
        "//pkg/testutils/testcluster",
        "//pkg/util",
        "//pkg/util/ctxgroup",
        "//pkg/util/encoding",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "//pkg/util/quotapool",
        "//pkg/util/randutil",
        "//pkg/util/retry",
        "//pkg/util/syncutil",
        "//pkg/util/timeutil",
        "//pkg/util/tracing",
        "//pkg/util/tracing/tracingpb",
        "//pkg/util/uuid",
        "@com_github_cockroachdb_apd_v3//:apd",
        "@com_github_cockroachdb_datadriven//:datadriven",
        "@com_github_cockroachdb_errors//:errors",
        "@com_github_jackc_pgx_v4//:pgx",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
        "@org_golang_google_grpc//:go_default_library",
    ],
)
